$(function() {
	$("#resizable").resizable({
			// aspectRatio : 16 / 9
			});

	$("#lgnbtn").button();

	$("#bakbtn").button().click(function() {
				window.history.back(-1);
			});

	$("#loginTip").css("display", "none");

	$("#formID").validationEngine({
		validationEventTriggers : "blur",
		inlineValidation : true,
		success : false,
		promptPosition : "bottomRight",
		submitButtonID : "lgnbtn",
		submitButtonFunc : function(r) {
			$("#loginTip").css("display", "none");
			$("#loginTip").html("");

			if (r) {
				var options = {
					beforeSubmit : function(formData, jqForm, options) {
						var queryString = $.param(formData);

						$("#lgnbtn").attr("disabled", "disabled");
						return true;
					},
					success : function showResponse(responseText, statusText) {
						if (responseText.success) {
							document.location = context + "/app/board.jsp";
						} else {
							$("#loginTip").css("display", "block");
							if (responseText.error == "-1") {
								$("#loginTip")
										.html("<div style=\"color:red;font-size:14px;padding-left:10px;font-weight:bold;\">入驻申请未通过审核，账号无效</div>");
							} else if (responseText.error == "-2") {
								$("#loginTip")
										.html("<div style=\"color:red;font-size:14px;padding-left:10px;font-weight:bold;\">账号已被冻结</div>");
							} else if (responseText.error == -999) {
								$("#loginTip")
										.html("<div style=\"color:red;font-size:14px;padding-left:10px;font-weight:bold;\">错误的用户名或密码</div>");
							}
							
							$("#lgnbtn").removeAttr("disabled");
						}
					},
					url : context + "/app/bcxdlogin.do", // override

					type : "post",
					// attribute
					// dataType: null // 'xml', 'script', or 'json'
					// (expected server
					// response type)
					// clearForm : true
					// clear all form fields after successful submit
					resetForm : true,
					// reset the form after
					// successful submit
					// $.ajax options can be used here too, for
					// example:
					// timeout: 3000
					iframe : false
				};

				$("#formID").ajaxSubmit(options);
			}
		}
	});
});